<!DOCTYPE html>
<html>
<#assign contextPath = request.contextPath/>
	<head>
		<meta charset="UTF-8">
		<title>我的投票</title>
		<link href="${contextPath}/css/bootstrap.min.css" rel="stylesheet">
		<script src="${contextPath}/js/echarts.common.min.js"></script>
		<script type="text/javascript" src="${contextPath}/js/jquery-3.0.0.min.js"></script>
	</head>

	<body>
		<#include "/common/nav.html">
		<div class="container-fluid">
			<div class="row">
				<#include "/common/left_user.html">
				<div class="col-sm-9">
					<ol class="breadcrumb">
					  <li><a href="#">主页</a></li>
					  <li class="active">我的投票</li>
					</ol>
					<div class="table-responsive">
						<table class="table table-striped">
							<thead>
								<tr>
									<th>序号</th>
									<th>投票名</th>
									<th>选项比</th>
									<th>我的选项</th>
								</tr>
							</thead>
							<tbody>
							<#list p.list as uv>
								<tr>
									<td>${uv_index+1}</td>
									<td>${uv.vote.vtitle}</td>
									<td>
										<div name="main" style="width: 300px;height:200px;" id="${uv.vote.vid}"></div>
									</td>
									<td>${uv.voteOption.voText}</td>
								</tr>
							</#list>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
		<script>
			$("[name=main]").each(function(index,e){
				var myChart = echarts.init(e);
				console.log(e.id);
				var vid = e.id;
				$.getJSON("${contextPath}/user/getOptionRatiouv.action", "vid="+vid,function(data) {
					option = {
						tooltip: {
							trigger: 'item',
							formatter: "{a} <br/>{b} : {c} ({d}%)"
						},
						calculable: true,
						series: [{
							name: '选项',
							type: 'pie',
							radius: '80%',
							data: data
						}]
					};
					myChart.setOption(option);
				})
			})
			
		</script>
	</body>

</html>